package org.davidliebman.android.flyer;



import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;

public class DialogFragmentGameStop extends FragmentActivity {

	private int mScreenOrientation = 0;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        mScreenOrientation = PreferenceManager.getDefaultSharedPreferences(getApplicationContext())
        		.getInt(Pager.SAVED_SCREEN_ORIENTATION, Pager.SCREEN_PORTRAIT);
        
        
        
        DialogFragmentParent mDialog = new GameOverDialog();
		mDialog.show(getSupportFragmentManager(), "GameOver");
	}
	
	
	class GameOverDialog extends DialogFragmentParent {
		@Override
		public void doPositive() {
			
			if (mScreenOrientation == Pager.SCREEN_PORTRAIT) {
				Intent mIntent = new Intent(DialogFragmentGameStop.this,GameStartPort.class);
				startActivity(mIntent);
			}
			else if (mScreenOrientation == Pager.SCREEN_LANDSCAPE) {
				Intent mIntent = new Intent(DialogFragmentGameStop.this,GameStartLand.class);
				startActivity(mIntent);
			}
			
		}
		@Override
		public void doNegative() {
			Intent mIntent = new Intent(DialogFragmentGameStop.this,Pager.class);
			startActivity(mIntent);
		}
		
	}
}
